package top.z.work.framework.doc.core;

import lombok.Data;

import java.util.concurrent.TimeUnit;

/**
 * Redis Key 定义类
 */
@Data
public class CacheKeyDefine {

    // 标题
    private final String   title;
    // Key 模板
    private final String   key;
    // 过期时间
    private final Integer  timeout;
    // 过期时间
    private final TimeUnit timeUnit;

    public CacheKeyDefine(String title, String key, Integer timeout, TimeUnit timeUnit) {
        this.title = title;
        this.key = key;
        this.timeout = timeout;
        this.timeUnit = timeUnit;
    }

    /**
     * 格式化 Key
     *
     * @param _key 参数
     * @return Key
     */
    public String formatKey(String _key) {
        return key + _key;
    }

}
